/*

Author   : chaos

FileName : void.cpp

Date     : 07/08/17 23:09:40

*/
#include <iostream>
using namespace std;

int main(void)
{
    int i = 10 ;
    double d = 1e50;
    int * ptr_i = &i , * ptr_i1 = NULL;
    double * ptr_d = &d, * ptr_d1 = NULL;
    void * ptr_void;

    ptr_void = ptr_i;
    ptr_i1 = reinterpret_cast<int *> (ptr_void);

    cout << "ptr_i = " << ptr_i << endl;
    cout << "ptr_void = " << ptr_void << endl;
    cout << "ptr_i1 = " << ptr_i1 << endl << endl;

    cout << "*ptr_i = " << *ptr_i << endl;
    cout << "*reinterpret_cast<int *>(ptr_void) = " << *reinterpret_cast<int *>(ptr_void) << endl;
    cout << "*ptr_i1 = " << *ptr_i1 << endl  << endl;


    ptr_void = ptr_d;
    ptr_d1 = reinterpret_cast<double *>(ptr_void);

    cout << "ptr_d = " << ptr_d << endl;
    cout << "ptr_void = " << ptr_void << endl;
    cout << "ptr_d1 = " << ptr_d1 << endl << endl;

    cout << "*ptr_d" << *ptr_d1 << endl << endl ;

    cout << "*reinterpret_cast<double *>(ptr_void) = " << *reinterpret_cast<double*>(ptr_void) << endl;
    cout << "*ptr_d1 = " << *ptr_d1 << endl;


    return 0;
}
